<?php
use yii\helpers\Html;
use yii\helpers\Url;

$this->title = "项目详情页混合类";
echo Html::cssFile('@web/css/projectDetails.css');
$this->registerJsFile('/js/projectDetails.js');
$this->registerJsFile('/js/jquery.validate.min.js');
$this->registerJsFile('/js/messages_zh.js');
$this->registerJsFile('/js/jquery.validate.extend.js');
$package_id = Yii::$app->request->get("package_id");
$project_id = Yii::$app->request->get("project_id");
?>
<style type="text/css">
.wrap {
     margin-top: 0px; 
}
.wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0; }

 .hunHeZhuanRangXinXi p span {
    line-height: 22px;
}
.hunHeZhuanRangXinXi .telTd {
    padding-left: 6px;
}
.hunHeZhuanRangXinXi .timePre {
		margin-top: -30px;
	}
.edit-tabs-ul1>li>a{
    display: inline-block;
    width: 105px;
    margin-left: -10px;
}

/** 联想搜索 **/
.select2-results__message{display: none;}
#province + .select2-container{  margin-left: 65px;  }
.selectText{  margin-left: 0;  margin-right: 4%  }
</style>
<link rel="stylesheet" href="">
<!-- 资产包详情  开始-->
<div class="container details" style="margin-top: 30px;">
    <?=
    $this->render('project-start-mortgage', ['Base' => $Base, 'packageName' => $packageName,'teamInfo'=>$teamInfo,'projectModel'=>$project])
    ?>
</div>
<!-- 资产包详情  结束 -->
<!--一键置 顶-->

<a href="#" class="clicktop" title="返回顶部">
	<!--<img src="image/common/clickTop.png" alt=""  />-->
</a>
<!-- 页内导航   开始-->
<div class="container edit-tabs navFix" style="margin-top: 10px!important;">
    <div class="row">
        <div class="navFixTop"></div>
        <ul class="edit-tabs-ul1 ">
            <li class="pull-left active edit-tabs-li1">
<!--                <a href="--><?php
//                echo Url::toRoute(['project/getinfodata', 'package_id' => $package_id, 'project_id' => $project_id]);
//                ?><!--">预评估信息</a>-->
                预评估信息
                <ul class="edit-tabs-ul2 myActiveBox" style="">
                    <li class="pull-left myActive">
                        <a data-href="#jiBen">基本信息</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#siFa">司法进展</a>
                    </li>
                    <!-- 禁止按钮类prohibit-->
                    <li class="pull-left ">
                        <a data-href="#jiaZhi">价值评估</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#buChong">补充说明</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#zhuanRang">转让信息</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#liuZhuan">流转、前期处置及维护情况</a>
                    </li>
                    <li class="pull-left ">
                        <a data-href="#tuanDui">团队成员</a>
                    </li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 myActiveBox">
                <a href="<?php
                echo Url::toRoute(['project-investigation/index', 'package_id' => $package_id, 'project_id' => $project_id]);
                ?>">尽调报告</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left ">
                        <a href="###">债权基本情况</a>
                    </li>
                    <li class="pull-left prohibit">
                        <a href="###">借款人及资产情况</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">保证人及资产情况</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">抵押人及抵押物情况</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">其他承债人及资产情况</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">尽调评估总结</a>
                    </li>
                    <li class="pull-left ">
                        <a href="###">关键附件</a>
                    </li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1">
                <a href="<?php
                echo Url::toRoute(['project/access-audit', 'package_id' => $package_id, 'project_id' => $project_id]);
                ?>">
                    审核情况
                </a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left "><a href="###">审核状况</a></li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 myActiveBox">
                <a href="<?php
                echo Url::toRoute(['project-log/index', 'package_id' => $package_id, 'project_id' => $project_id]);
                ?>">操作日志</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left myActive">
                        <a href="###">操作记录</a>
                    </li>
                    <li class="pull-left">
                        <a href="###">数据更新纪录</a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<!-- 页内导航   结束-->
<div class="jiBenXinXi jiBenXinXiW" id="jiBen">
    <!--//基本信息-->
    <?= $this->render('base', [
        'Base' => $Base,
    ])
    ?>
</div>
<!--基本信息 编辑-->
<div class="jiBenXinXi jiBenXinXiEdit" id="jiBenXinXiEdit" style="display: none;">
</div>
<!--//司法进展-->
<div class="suSongXinXi siFaW" id="siFa">
    <?= $this->render('judicial', [
        'Lawsuit' => $Lawsuit,
    ])
    ?>
</div>
<!--司法进展编辑-->
<div class="suSongXinXi siFaEdit" id="siFa" style="display: none;">
</div>

<!--//价值评估-->
<div class="jiaZhiPingGu jiaZhiPingGuW" id="jiaZhi">
    <?= $this->render('assessment', [
        'evaluation' => $evaluation,
    ])
    ?>
</div>
<!--<!--//价值评估编辑-->
<div class="jiaZhiPingGu jiaZhiPingGuEdit" id="jiaZhi" style="display: none;">
</div>
<!--//补充说明-->
<div class="buChongShuoMing buChongShuoMingW" id="buChong">
    <?= $this->render('explain', [
        'note' => $note,
    ])
    ?>
</div>
<!--补充说明-->

<div class="buChongShuoMing buChongShuoMingEdit" id="buChong" style="display: none;">

</div>

<!--//转让信息-->
<div class="zhuanRangXinXi zhuanRangXinXiW hunHeZhuanRangXinXi" id="zhuanRang">
    <?= $this->render('make', [
        'transfer' => $transfer,
    ])
    ?>
</div>

<!--转让信息编辑-->
<div class="zhuanRangXinXi zhuanRangXinXiEdit" id="zhuanRang" style="display: none;">
</div>

<!--//流转、前期处置及维护情况-->
<div class="liuZhuanJiWieHu liuZhuanJiWieHuW" id="liuZhuan">
    <?= $this->render('maintain', [
        'transferHistory' => $transferHistory,
    ])
    ?>
</div>
<!--//流转、前期处置及维护情况编辑-->
<div class="liuZhuan liuZhuanEdit liuZhuanJiWieHuEdit hunHeliuZhuanEdit" id="liuZhuan" style="display: none;">
</div>


<!--//团队成员-->
<div class="tuanDuiChengYuan tuanDuiChengYuanW" id="tuanDui">
    <?= $this->render('team', [
        'team' => $team,
        'teamXZR' => $teamXZR,
        'teamFZR' => $teamFZR,
        'teamZJ' => $teamZJ,
    ])
    ?>
</div>
<!--<!--//团队成员编辑-->
<div class="tuanDuiChengYuan tuanDuiChengYuanEdit" id="tuanDui" style="display: none;">

</div>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModal">
    <?php
    echo $this->render('modal/asset-project-editing-permissions', ['projectid' => $Base['id'], 'departments' => $Base['departments'], 'access' => $Base['access'], 'access_users_ids' => $Base['access_users_ids']]);//修改访问权限
    ?>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModal2">
    <?php
    //var_dump($team);exit;
    echo $this->render('modal/asset-project-editing-team', ['projectid' => $Base['id'],'userChief'=>$userChief,'user'=>$user,'team'=>$team, 'teamXZR'=>$teamXZR, 'teamFZR'=>$teamFZR,'teamZJ'=>$teamZJ]);
    ?>
</div>
<!-- Modal -->
<div class="modal fade modal-focus" id="myModalLabel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog2" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="modal-body-focus">
                    <img src="/image/assetPackage/smile.png">
                    <p class="focus">关注成功</p>
                    <p>有更新系统会第一时间通知您</p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btns-primary" data-dismiss="modal">确定</button>

            </div>
        </div>
    </div>
</div>
<!-- 模态窗口  结束!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- textarea 高度设置对比div -->
	<div style="max-height: 1px;overflow: hidden;">
		<div id="d1" style="visibility:hidden;min-height:80px!important;"></div>
	</div>
<script>
    var project_id = '<?= Yii::$app->request->get("project_id", 1)?>'; //亮点明细
    var package_id = '<?= Yii::$app->request->get("package_id", 1)?>'; //亮点明细
//    同步居间人和持有人列表大小
	for(var i = 0; i < $('.tableRight').find('tr').length; i++){
    		if($('.tableRight').find('tr').eq(i).height()>$('.tableLeft').find('tr').eq(i).height()){
    			$('.tableLeft').find('tr').eq(i).height($('.tableRight').find('tr').eq(i).height())
    		}else{
    			$('.tableRight').find('tr').eq(i).height($('.tableLeft').find('tr').eq(i).height())
    		}
    	}
    $(".like").on('click', function () {
        var value = $(this).attr('data').split('-');
        var url = '/project/set-project-like';
        if (value[2] == 2) {
            url = '/project/set-project-light';
        }
        $.get(url, {'project_id': project_id, 'del': value[1], 'type': value[2]}, function (res) {
            if (res.status) {
                $("#" + value[0] + "_img").attr('src', res.img);
                $("#" + value[0]).attr('data', value[0] + '-' + res.type + '-' + value[2]);
                if (res.type == 1 && value[2] == 1) {
                    $("#flow .pull-left").html("已关注");
                    $('#myModalLabel').modal('show');
                } else {
                    layer.msg(res.msg);
                    $("#flow .pull-left").html("关注");
                }
            } else {
                layer.msg(res.msg);
            }
        });
    });
    
   var editImg  = true;

    $(document).on('click', '#getBase,#getJudicial,#getPingGu,#getExplain,#getMake,#getMain,#getTeam', (function () {
       
    	 if(editImg){
	        var postionVal = $(this).data('val');
			     $.get('/project/get-base-data', {
			            'project_id': project_id,
			            'postion': postionVal,
			            'package_id': package_id,
			        }, function (res) {
			        	
	            jsonData = JSON.parse(res)
	            switch (postionVal) {
	                case 1:
	                    if (jsonData.code == 200){
	                        $("#jiBenXinXiEdit").html(jsonData.data.res);
	                        $("#jiBenXinXiEdit").show();
	                        $(".jiBenXinXiW").hide();
	                        editImg  = false;
	                          
						    //textarea编辑高度和输入框高亮显示功能开始
							var listArr = ['input','select']
							listArr.forEach(function(value,index,arr){
								$(value).focus(function(){
									$(this).css({
											"border":"1px solid #2194f1"
									})
								})
								$(value).blur(function(){
									$(this).css({
											"border":"1px solid #e2e2e2"
									})
								})
							})
							  // textarea 高度展示问题和高亮显示开始
							  $(document).on('focus','.textarea-edit',function(){
							 	textareaHeight(this);
							 	$(this).css({
										"border":"1px solid #2194f1"
								})
							 })
							   $(document).on('blur','.textarea-edit',function(){
							 	$(this).css({
										"border":"1px solid #e2e2e2"
								})
							 })
							  $(document).on('keyup','.textarea-edit',function(){
						     	textareaHeight(this);
						     })
						     // textarea 高度展示问题和高亮显示结束
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 3:
	                    if (jsonData.code == 200){
	                        $(".siFaEdit").html(jsonData.data.res);
	                        $(".siFaEdit").show();
	                        $(".siFaW").hide();
	                        editImg  = false;
	                        
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 5:
	                    if (jsonData.code == 200){
	                        $(".jiaZhiPingGuEdit").html(jsonData.data.res);
	                        $(".jiaZhiPingGuEdit").show();
	                        $(".jiaZhiPingGuW").hide();
	                        editImg  = false;
	                       
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 7:
	                    if (jsonData.code == 200){
	                        $(".buChongShuoMingEdit").html(jsonData.data.res);
	                        $(".buChongShuoMingEdit").show();
	                        $(".buChongShuoMingW").hide();
	                        editImg  = false;
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 9:
	                    if (jsonData.code == 200){
	                        $(".zhuanRangXinXiEdit").html(jsonData.data.res);
	                        $(".zhuanRangXinXiEdit").show();
	                        $(".zhuanRangXinXiW").hide();
	                        editImg  = false;
	                         //textarea编辑高度和输入框高亮显示功能开始
							var listArr = ['input']
							listArr.forEach(function(value,index,arr){
								$(value).focus(function(){
									$(this).css({
											"border":"1px solid #2194f1"
									})
								})
								$(value).blur(function(){
									$(this).css({
											"border":"1px solid #e2e2e2"
									})
								})
							})
							  // textarea 高度展示问题和高亮显示开始
							  $(document).on('focus','.textarea-edit9',function(){
							 	textareaHeight(this);
							 	$(this).css({
										"border":"1px solid #2194f1"
								})
							 })
							   $(document).on('blur','.textarea-edit9',function(){
							 	$(this).css({
										"border":"1px solid #e2e2e2"
								})
							 })
							  $(document).on('keyup','.textarea-edit9',function(){
						     	textareaHeight(this);
						     })
						     // textarea 高度展示问题和高亮显示结束
	                       
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 11:
	                    if (jsonData.code == 200){
	                        $(".liuZhuanJiWieHuEdit").html(jsonData.data.res);
	                        $(".liuZhuanJiWieHuEdit").show();
	                        $(".liuZhuanJiWieHuW").hide();
	                        editImg  = false;
	                         //textarea编辑高度和输入框高亮显示功能开始
							var listArr = ['input']
							listArr.forEach(function(value,index,arr){
								$(document).on('focus',value,function(){
									$(this).css({
											"border":"1px solid #2194f1"
									})
								})
								$(document).on('blur',value,function(){
									$(this).css({
											"border":"1px solid #e2e2e2"
									})
								})
							})
						     // textarea 高度展示问题和高亮显示结束
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                case 13:
	                    if (jsonData.code == 200){
	                        $(".tuanDuiChengYuanEdit").html(jsonData.data.res);
	                        $(".tuanDuiChengYuanEdit").show();
	                        $(".tuanDuiChengYuanW").hide();
	                        editImg  = false;
	                    }else{
	                        layer.msg(jsonData.message)
	                    }
	                    break;
	                default:
	                    if (jsonData.code == 200){
	                        $("#jiBenXinXiEdit").html(jsonData.data.resjsonData.data.res);
	                        $("#jiBenXinXiEdit").show();
	                        $(".jiBenXinXiW").hide();
	                        editImg  = false;
	                    }else{
	                        layer.msg(jsonData.message)
	                    }

	                    break;
	            }
	        
      	  })
        
         }else{
         	layer.alert("只能编辑一个模块");
         	return false;
         }
    }))
    
    
    $(document).on("click",'.cancelInConfirm input[type="button"]',function(){
    	editImg  = true;
    	//    同步居间人和持有人列表大小
		for(var i = 0; i < $('.tableRight').find('tr').length; i++){
    		if($('.tableRight').find('tr').eq(i).height()>$('.tableLeft').find('tr').eq(i).height()){
    			$('.tableLeft').find('tr').eq(i).height($('.tableRight').find('tr').eq(i).height())
    		}else{
    			$('.tableRight').find('tr').eq(i).height($('.tableLeft').find('tr').eq(i).height())
    		}
    	}
    })
    
  function textareaHeight(th){
    	 var val = $(th).val();
	      $("#d1").width($(th).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
		      $(th).height(h);
	}
</script>